<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    const arrOne=[1,2,3]
    const arrTow=[2,3,4,5,6]
    // 交
    const intersetionFn=(arr1,arr2)=>{
        const ressult=arr1.filter(item1=>arr2.some(item2=>item1===item2))
        console.log('交',ressult);
        return ressult
    }
    intersetionFn(arrOne,arrTow) 
    // 补
    const complementFn=(arr1,arr2)=>{
        const result =arr1.filter(item1=>arr2.every(item2=>item1 !==item2)
        )
        console.log('补',result);
    }
    complementFn(arrOne,arrTow)
    // 并
    const unionFn=(arr1,arr2)=>{
        const result =arr1.filter(item1=>arr2.every(item2=>item1 !==item2)
        ).concat(arr2)
        console.log(' 并',result);
    }
    unionFn(arrOne,arrTow)

</script>
</html>